Skip to content

[linux][disk]: fix disk mountinfo parsing bug#2007

Merged
shirou merged 1 commit intomasterfrom
fix/fix_disk_mountinfo_parsing_bugs
Feb 27, 2026
Merged

[linux][disk]: fix disk mountinfo parsing bug#2007
shirou merged 1 commit intomasterfrom
fix/fix_disk_mountinfo_parsing_bugs

Conversation

@shirou
Copy link
Copy Markdown
Owner

@shirou shirou commented Feb 23, 2026

This PR fixes those 3 bugs in seenDevIDs logic in parseFieldsOnMountinfo() which are introduced #1931. fixes #2005.

  1. Device field cascading - Previously stored mountPoint in seenDevIDs and overwrote on every occurrence, causing wrong Device values. Now stores the device path and only on first occurrence.
  2. Missing bind on first bind mount - Previously only detected bind when a device was seen before. Now uses rootDir != "/" as the primary signal, which correctly identifies subdirectory mounts.
  3. Incorrect bind on root mount - Previously marked any repeated device as bind. Now the root mount (rootDir == "/") is correctly left as non-bind even if the device was seen before.
  4. Edge case: virtual filesystems - Added strings.HasPrefix(mntSrc, "/") guard so virtual filesystems like nsfs (where rootDir is an identifier like net:[12345], not a path) aren't falsely marked as bind mounts.

@shirou shirou merged commit 6320f9e into master Feb 27, 2026
54 checks passed
@shirou shirou deleted the fix/fix_disk_mountinfo_parsing_bugs branch February 27, 2026 10:15
gh-worker-dd-mergequeue-cf854d Bot pushed a commit to DataDog/datadog-agent that referenced this pull request Mar 2, 2026
### What does this PR do?
Bump gopsutil to v4.26.2

### Motivation
This release fixes various issues introduced in v4.25.12

See https://github.com/shirou/gopsutil/issue/2005 and shirou/gopsutil#2007.

### Describe how you validated your changes
Tested locally and deployed a custom build internally to validate the fix PR.

### Additional Notes


Co-authored-by: pierre.gimalac <pierre.gimalac@datadoghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Various disk mountinfo parsing bugs on Linux introduced by #1931

1 participant